﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="PublishService.aspx.cs" Inherits="SaaS.PublishService" %>

<%@ Register assembly="System.Web.Entity, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" namespace="System.Web.UI.WebControls" tagprefix="asp" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Publish Service</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    
        <asp:HyperLink ID="HyperLink1" runat="server" 
            NavigateUrl="~/PublishingManager.aspx">&lt;- Back</asp:HyperLink>
    
        <br />
        <asp:Label ID="Label1" runat="server" Font-Bold="True" Font-Size="Large" 
            Text="Publish Service"></asp:Label>
        <br />
        Here you may publish a public service to be discovered and used by any user.<br />
    
        <br />
        Service Name:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
        <asp:TextBox ID="txtServiceName" runat="server" Width="171px" 
            style="margin-left: 15px"></asp:TextBox>
        <br />
        Service Path:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;
        <asp:TextBox ID="txtServicePath" runat="server" Width="171px" 
            style="margin-left: 13px"></asp:TextBox>
&nbsp;(Begin path with &#39;/&#39; if it is local to site)<br />
        Service Function:&nbsp;&nbsp; &nbsp;&nbsp;         
        <asp:TextBox ID="txtServiceFunction" runat="server" Width="171px" 
            style="margin-left: 16px"></asp:TextBox>
        <br />
        Service Description: 
        <asp:TextBox ID="txtServiceDescription" runat="server" Height="78px" 
            Width="170px" TextMode="MultiLine" style="margin-left: 18px"></asp:TextBox>
        <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Add" />
        <br />
&nbsp;<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
            CellPadding="4" DataKeyNames="Service_ID" DataSourceID="SqlDataSource1" 
            ForeColor="#333333" GridLines="None" onrowcommand="GridView1_RowCommand" 
            onrowdeleting="GridView1_RowDeleting" 
            onselectedindexchanged="GridView1_SelectedIndexChanged" 
            style="margin-top: 0px" ondatabinding="GridView1_DataBinding">
            <RowStyle BackColor="#EFF3FB" />
            <Columns>
                <asp:BoundField DataField="Service_ID" HeaderText="ID" ReadOnly="True" 
                    SortExpression="Service_ID" />
                <asp:BoundField DataField="Service_Name" HeaderText="Name" 
                    SortExpression="Service_Name" />
                <asp:BoundField DataField="Service_Function_Name" 
                    HeaderText="Function Name" SortExpression="Service_Function_Name" />
                <asp:BoundField DataField="Service_Path" HeaderText="Path" 
                    SortExpression="Service_Path" />
                <asp:BoundField DataField="Service_Description" 
                    HeaderText="Description" SortExpression="Service_Description" />
                <asp:ButtonField CommandName="Del" Text="Delete" />
                <asp:CommandField ShowEditButton="True" />
            </Columns>
            <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
            <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
            <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
            <EditRowStyle BackColor="#2461BF" />
            <AlternatingRowStyle BackColor="White" />
        </asp:GridView>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
            ConnectionString="<%$ ConnectionStrings:MiniSaaSConnectionString %>" 
            
            SelectCommand="SELECT [Service_ID], [Service_Name], [Service_Path], [Service_Function_Name], [Service_Description] FROM [SERVICE]" 
            ondeleting="SqlDataSource1_Deleting" 
            DeleteCommand="DELETE FROM [SERVICE] WHERE [Service_ID] = @Service_ID" 
            InsertCommand="INSERT INTO [SERVICE] ([Service_ID], [Service_Name], [Service_Path], [Service_Function_Name], [Service_Description]) VALUES (@Service_ID, @Service_Name, @Service_Path, @Service_Function_Name, @Service_Description)" 
            UpdateCommand="UPDATE [SERVICE] SET [Service_Name] = @Service_Name, [Service_Path] = @Service_Path, [Service_Function_Name] = @Service_Function_Name, [Service_Description] = @Service_Description WHERE [Service_ID] = @Service_ID">
            <DeleteParameters>
                <asp:Parameter Name="Service_ID" Type="Int32" />
            </DeleteParameters>
            <UpdateParameters>
                <asp:Parameter Name="Service_Name" Type="String" />
                <asp:Parameter Name="Service_Path" Type="String" />
                <asp:Parameter Name="Service_Function_Name" Type="String" />
                <asp:Parameter Name="Service_Description" Type="String" />
                <asp:Parameter Name="Service_ID" Type="Int32" />
            </UpdateParameters>
            <InsertParameters>
                <asp:Parameter Name="Service_ID" Type="Int32" />
                <asp:Parameter Name="Service_Name" Type="String" />
                <asp:Parameter Name="Service_Path" Type="String" />
                <asp:Parameter Name="Service_Function_Name" Type="String" />
                <asp:Parameter Name="Service_Description" Type="String" />
            </InsertParameters>
        </asp:SqlDataSource>
    
    </div>
    </form>
</body>
</html>
